package com.nhim.cms.domain;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Version;
/**
 * CustomWidgetPropertyValue entity. @author Huy Lieu Ta
 */
@Entity
@Table(name = "nhim_custom_widget_property_value", catalog = "nhim_cms")
public class CustomWidgetPropertyValue implements java.io.Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer id;
	private String name;
	private String dataType;
	private String value;
	private Integer version;
	private CustomWidgetInstance customWidgetInstance;

	
	// Constructors

	/** default constructor */
	public CustomWidgetPropertyValue() {
	}

	/** minimal constructor */
	public CustomWidgetPropertyValue(String name, String dataType,String value) {
		this.name = name;
		this.dataType = dataType;
		this.value = value;
	
	}

	/** full constructor */
	public CustomWidgetPropertyValue(String name, String dataType,String value,CustomWidgetInstance customWidgetInstance, Integer version) {
		this.name = name;
		this.dataType = dataType;
		this.value = value;
		this.customWidgetInstance = customWidgetInstance;
		this.version = version;
	
	}
	
	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	@Column(name = "name", nullable = false, length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "data_type", nullable = false, length = 15)
	public String getDataType() {
		return this.dataType;
	}

	public void setDataType(String dataType) {
		this.dataType = dataType;
	}
	@Column(name="value", nullable = false,length = 50000)
	public String getValue() {
		return this.value;
	}

	public void setValue(String value) {
		this.value = value;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "instance_id")
	public CustomWidgetInstance getCustomWidgetInstance() {
		return this.customWidgetInstance;
	}

	public void setCustomWidgetInstance(CustomWidgetInstance customWidgetInstance) {
		this.customWidgetInstance = customWidgetInstance;
	}
	
	@Version
	@Column(name = "version")
	public Integer getVersion() {
		return this.version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}
	

}
